package cn.webdai.activemq.listener;

import cn.webdai.activemq.pojo.MessageModel;
import com.alibaba.fastjson.JSON;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

/**
 * @author 戴金华
 * @date 2019-12-30 19:01
 */
@Component
public class DelayMessageListener {

    @JmsListener(destination = "delayQueue")
    public void getDelayMessage(String message){
        MessageModel messageModel = JSON.parseObject(message, MessageModel.class);
        System.out.println("获得消息的时间是"+System.currentTimeMillis());
        System.out.println("接受到的对象信息是:"+messageModel);
    }
}
